package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.LogMapper;
import com.itheima.pojo.*;
import com.itheima.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;

//    @Override
//    public PageResult<OperateLog> page(LogQueryParam logQueryParam) {
//
//        PageHelper.startPage(logQueryParam.getPage(),  logQueryParam.getPageSize());
//        List<OperateLog> logList = logMapper.list();
//        Page<OperateLog> l = (Page<OperateLog>) logList;
//
//        return new PageResult<OperateLog>(l.getTotal(),l.getResult());
//    }

    @Override
    public PageResult<OperateLog> page(Integer page, Integer pageSize) {

        PageHelper.startPage(page, pageSize);
        List<OperateLog> logList = logMapper.list();
        Page<OperateLog> l = (Page<OperateLog>) logList;

        return new PageResult<OperateLog>(l.getTotal(),l.getResult());
    }

}
